//
//  Factory.m
//  Charles
//
//  Created by Charles on 2017/6/15.
//  Copyright © 2017年 charles. All rights reserved.
//

#import "Factory.h"


@implementation SimplePizzaFactory

- (Pizza *)createPizza:(NSString *)type {
    Pizza *pizza = nil;
    if ([type isEqualToString:@"cheese"]) {
        pizza = [[NYCheesePizza alloc]init];
    } else if ([type isEqualToString:@"pepperoni"]) {
        pizza = [[NYPepperoniPizza alloc]init];
    } else if ([type isEqualToString:@"clam"]) {
        pizza = [[NYClamPizza alloc]init];
    } else if ([type isEqualToString:@"veggie"]) {
        pizza = [[NYVeggiePizza alloc]init];
    }
    return pizza;
}

@end

@implementation NYPizzaIngredientFactory

- (id<Dough>)createDugh {
    id<Dough> dough = [[ThinCrustDough alloc]init];
    NSLog(@"%@",dough.toString);
    return dough;
}

- (id<Sauce>)createSauce {
    id<Sauce> sauce = [[MarinaraSauce alloc]init];
    NSLog(@"%@",sauce.toString);
    return sauce;
}

- (id<Cheese>)createCheese {
    id<Cheese> cheese = [[ReggianoCheese alloc]init];
    NSLog(@"%@",cheese.toString);
    return cheese;
}

- (id<Clams>)createCalm {
    id<Clams> calm = [[FreshClams alloc]init];
    NSLog(@"%@",calm.toString);
    return calm;
}

- (NSMutableArray *)createVeggies {
    NSMutableArray * veggies = [[NSMutableArray alloc]initWithCapacity:0];
    return veggies;
}

@end
